package com.sky.mapper;


import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface SetmealDishMapper {


    /**
     * 根据菜品ID查询套餐id
     * @param dishIds
     * @return
     */
    List<Long> getSetmealIdsByDishId(List<Long> dishIds);


    /**
     * 添加关系数据
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);


    /**
     * 根据套餐ID查询所有的关系数据
     * @param setmealId
     * @return
     */
    @Select("select * from sky_take_out.setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> selectStemealAndDishBySetmealId(Long setmealId);


    /**
     * 通过套餐ID删除关联信息
     * @param setmealId
     */
    @Delete("delete from sky_take_out.setmeal_dish where setmeal_id = #{setmealId}")
    void deleteSetmealDish(Long setmealId);


    /**
     * 通过套餐ID批量删除关联信息
     * @param ids
     */
    void deleteSetmealDishByIds(List<Long> ids);
}
